package com.zc.app.delegation;

/**
 * Created by User on 2017/6/8.
 */
public abstract class Duck {
    private FlyBehaviro flyBehaviro;
    private QuackBehavior quackBehavior;

    public abstract void display();

    public FlyBehaviro getFlyBehaviro() {
        return flyBehaviro;
    }

    public void setFlyBehaviro(FlyBehaviro flyBehaviro) {
        this.flyBehaviro = flyBehaviro;
    }

    public QuackBehavior getQuackBehavior() {
        return quackBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }

    public void performFly() {
        flyBehaviro.fly();
    }

    public void performQuack() {
        quackBehavior.quack();

    }

    public void swim() {
        System.out.println("All duck float, even decoys!");
    }
}
